package com.minhua.jijiehao2.mainframe.loan.loanfragment.impl

import com.minhua.jijiehao2.bean.BaseBean
import com.minhua.jijiehao2.bean.ChannelBean
import com.minhua.jijiehao2.bean.GridBean
import com.minhua.jijiehao2.http.*
import com.minhua.jijiehao2.mainframe.loan.loanfragment.imp.ILoanModel

class LoanModel : ILoanModel {
    override fun getMoneyList(): List<GridBean> = arrayListOf(
            GridBean("不限", true),
            GridBean("2000以下", false),
            GridBean("2000-5000", false),
            GridBean("5000以上", false))

    override fun getDateList(): List<GridBean> = arrayListOf(
            GridBean("不限", true),
            GridBean("7天", false),
            GridBean("15天", false),
            GridBean("5000以上", false),
            GridBean("1-6个月", false),
            GridBean("6-12个月", false),
            GridBean("12个月以上", false))

    override fun getChannelList(map: ParamsMap, callBack: CallBack<List<ChannelBean>>) {
        HttpController<List<ChannelBean>>().doHttp(
                ApiClient.getInstance().api.getLoanList(map.toRequestBody()),
                object : BaseSubscriber<List<ChannelBean>>() {
                    override fun dealData(t: BaseBean<List<ChannelBean>>) {
                        callBack.onSuccess(t)
                    }
                }, false
        )
    }
}